<?php
/**
 * Created by IntelliJ IDEA.
 * User: wanglu
 * Date: 2017/7/19
 * Time: 14:13
 */
/**
 * Created by wanglu on 2017/7/19.
 */
class SUser extends AdminBase {

    function __construct() {
        parent::__construct();
        $this->load->model('suser_model');
        $this->load->library('UCUser');
        $this->load->config('aliyun_oss');
    }


    public function user_list() {
        $this->showView("user_slightech_list");
    }



    public function data() {
        $search = $this->input->post("search");
        $order = $this->input->post("order");
        $order_by_createtime =  $order[0]["dir"];
        $searchValue = $search['value'];

        $start = $this->input->post("start");
        $length = $this->input->post("length");
        $data = $this ->suser_model->get_users($start, $length, $searchValue, $order_by_createtime);
        $user_domain = $this->config->item('user_avatar_domain');
        foreach ($data['data'] as $key => $value) {
            $data['data'][$key]["regdate"] = date("Y-m-d  h:i:s", $data['data'][$key]["regdate"]);
            $avatar =  $user_domain . '/'.ENVIRONMENT."/" . $this->ucuser->uc_get_avatar($value['uid'], 'big');
            $data['data'][$key]['pic'] = $avatar;
            $data['data'][$key]["en_user_id"] = $this->idcrypt->encode_user_id($value["uid"]);
        }

        echo json_encode($data);
    }

}